package part1.api.object.objecttest;

import java.util.Arrays;

public class test {
    public static void main(String[] args) {

        /*
        1. 定义字符串String path = "http://localhost:8088/myweb/reg?name=zhangsan&pwd=123456&nick=san&age=16";
         要求得到并输出：参数名:name  参数值：zhangsan
                      参数名:pwd   参数值: 123456
                      参数名:nick  参数值: san
                      参数名:age   参数值: 16
         */
        String path = "http://localhost:8088/myweb/reg?name=zhangsan&pwd=123456&nick=san&age=16";
        String[] arr1 = path.split("\\?");
        System.out.println(Arrays.toString(arr1));
        path = arr1[1];
        String[] arr2 = path.split("&");
        System.out.println(Arrays.toString(arr2));
        for (int i = 0; i < arr2.length; i++) {
            path = arr2[i];
            String[] arr3 = path.split("=");
            System.out.println("参数名:"+arr3[0]+"\t"+"参数值:"+arr3[1]);
        }
    }
}
